package system;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * Getting current Time and/or Date
 * @author zem
 */
public class getTimeDate {

    /**
     * Getting current Time and/or Date
     * @param dateFormat the format of needed date/time
     * @return Current Time or/and Date in specified date format
     */
    public String getTimeDate(String dateFormat) {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        return sdf.format(cal.getTime());
    }
}
